<template>
	<view class="">
		<view class="list">
			<view class="list-msg dis" v-for="(item,index) in list" :key="index" @click="goPage(item.url)">
				<view class="list-msg-img">
					<image :src="item.image" mode=""></image>
				</view>
				<view class="list-msg-msg dis">
					<view class="list-msg-msg-left">{{item.storeName}}
					</view>
					<view class="list-msg-msg-center">
						<text v-for="(items,index) in item.tags">{{items}}</text>

					</view>
					<view class="list-msg-msg-center dis" @click.stop="openLocation(item)">
						<view>
							<image src="../../../static/pagesA/icon_dw.png" mode="scaleToFill"></image>
						</view>
						<view>{{item.address}}</view>


					</view>
					<view class="list-msg-msg-bom dis" v-if="type==2">
						<view class="list-msg-msg-bom-left">
							<text style="font-size: 22rpx;">￥</text>
							{{item.price}}/晚
						</view>
						<view class="list-msg-msg-bom-right">已售{{item.sales}}</view>

					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ["type", "list"],
		data() {
			return {

			}
		},
		methods: {
			goPage(url) {
				uni.navigateTo({
					url
				})
				return;
				// '/pagesA/qualityRoutes/info'
				// console.log(,'传过来的没那')
				if (this.type == 1) {
					uni.navigateTo({
						url: '/pagesA/BeautifulEconomy/cateringInfo'
					})

				} else if (this.type == 2) {
					uni.navigateTo({
						url: '/pagesA/BeautifulEconomy/homestayInfo'
					})
				}
			},
			openLocation(item) {

				uni.openLocation({
					latitude: Number(item.latitude), // 目标纬度
					longitude: Number(item.longitude), // 目标经度
					name: item.address,
					address: item.address,
					success: function() {
						console.log('打开地图导航成功');
					},
					fail: function(err) {
						console.log('打开地图导航失败', err);
					}
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.list {
		width: 100%;

		.list-msg {
			.list-msg-msg-center {
				text {
					// padding: 7rpx 30rpx;
				}

				// padding: 7rpx 30rpx;

				color: #999;
				font-size: 24rpx;
				align-items: center;



				image {
					width: 36rpx;
					height: 36rpx;
					margin-right: 20rpx;

				}

				margin: 20rpx 0;
			}

			.list-msg-msg-bom {
				justify-content: space-between;

				.list-msg-msg-bom-left {
					color: $maincolor ;
					font-size: 32rpx;
				}

				.list-msg-msg-bom-right {
					color: #999;
					font-size: 24rpx;
				}

			}

			.list-msg-msg {
				flex-direction: column;
				justify-content: space-between;
				width: 67%;

				.list-msg-msg-center {
					// padding: 7rpx 30rpx;

					text {
						border-radius: 100rpx;
						font-size: 22rpx;
						padding: 7rpx 20rpx;

						margin-right: 10rpx;
						border: 1rpx solid $maincolor;
					}
				}

				.list-msg-msg-left {
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					/* 限制在三行 */
					-webkit-box-orient: vertical;
					font-size: 28rpx;
				}
			}

			.list-msg-img {
				width: 200rpx;
				height: 200rpx;

				image {
					border-radius: 10rpx;
					width: 100%;
					height: 100%;
				}
			}

			margin-bottom: 20rpx;
			background: #fff;
			padding: 30rpx;
			justify-content: space-between;

		}
	}
</style>